package TAIC.util;

import java.io.File;
import java.io.PrintStream;
import java.util.Scanner;

public class MakeCodeCorpus {

	/**
	 * This Program make the ImageCorpus.txt in order to generate the code book
	 * @param args
	 */
	public static void main(String[] args) {
		if ( args.length != 1 ) {
			System.out.println ( "please input the configFile that contains all the folder names" ) ;
			return ;
		}
		
		int count = 0 ;
		try {
			Scanner scanner = new Scanner ( new File ( args [ 0 ] )) ;
			PrintStream fout = new PrintStream ( new File ( "ImageCorpus.txt")) ; 
			while ( scanner.hasNext() ) {
				String dirName = scanner.next(); 
				Scanner sc1 = new Scanner ( new File ( dirName + "\\index.txt"));
				while ( sc1.hasNextLine() ) fout.println ( count + " 0 " + dirName + "\\" + sc1.nextLine() );
				sc1.close() ;
				count ++ ; 
			}
			fout.close () ;
			scanner.close() ;
		}catch ( Exception e ) {
			e.printStackTrace() ;
		}
		
	}

}
